﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Dados.ConexaoCE;
using System.Data;
using System.Collections;

namespace EFITransmissao.Dados.DAO
{
    public class DAOFotosAleatorias
    {
        public DAOFotosAleatorias() { }
        
        private static string _strConexao = @"Persist Security Info = false; 
                                   Data Source = .\Storage Card\Leituras.sdf";

        public static int ObterTotalFotos(string iduc)
        {
            int retorno = 0;
            try
            {
                Hashtable prm = new Hashtable();
                prm["@uc"] = iduc;

                CEMSDataAccess db = new CEMSDataAccess(_strConexao);
                DataTable dt = db.ExecutaConsulta("ObterTotalFotos_Aleatorias", prm);

                foreach (DataRow dr in dt.Rows)
                {
                    retorno = int.Parse(dr["Qtd"].ToString());
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return retorno;
        }
    }
}
